import React, { Component } from 'react';

export function HocComp(Comp) {
  return class _ extends Component {
    game = () => {
      const { type, cid } = this.props;
      console.log(type, cid);
    };

    componentDidMount() {
      document.documentElement.scrollTop = localStorage.getItem('scroll');
    }
    componentWillUnmount() {
      localStorage.setItem('scroll', document.documentElement.scrollTop);
    }

    render() {
      return <Comp game={this.game} />;
    }
  };
}
